/*
 *  this file store the relate quetions of all the questions
 *
 */
#ifndef RelatedQuestions_H_
#define RelatedQuestions_H_
#include "header.h"
class RelatedQuestions {
    public:
        RelatedQuestions();
        RelatedQuestions(const char* relatedFileName, const char * inlinkFile,
                int neighbor_num);
        void load(const char* relatedFileName, const char * inlinkFile, int num,
                int neighbor_num);
        ~RelatedQuestions();
        int getInlink(int qId);
        /**
          * (1)update the related Questions of qId
          * (2)update the inlinks array: a. minus the original one, b. add the new one
          */ 
        void updateRelatedQuestions(int qId, std::vector<mypair> &knns);
    private:
        int loadInLink(const char* inLinkFile);
        int loadRelatedQuestions(const char* relatedFileName);
        vector<int> inlinks; //store the inlink of all the questions;
        vector< vector<int> > relates; //store the related questions of all the questions
        int num; //store the total question number
        int neighbor_num; //store the number of neighbor of every question
};

#endif //RelatedQuestions_H_
